package com.ifcreate.infowell.sys.service;

import com.ifcreate.infowell.common.util.JsonResult;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

/**
 * @Author PuaChen
 * @Create 2018-07-16
 */
public interface FileUploadService {

    /**
     * 最基础的文件上传
     *
     * @param file
     * @param namePrefix
     * @return 成功后返回的是文件名称地址 可直接存入数据库的
     */
    JsonResult<UploadResult> upload(MultipartFile file, String namePrefix);

    File getRootDir();

    UploadResult getFileInfo(File file);

    @Data
    class UploadResult {
        private String originalName;
        private String name;
        private String url;
        private String size;
        private String mediaId;
    }
}
